Color

public interface Color

A numeric model of an RGB color. The components of the color instance are presented in the arithmetic notation. This means that each component accepts any fractional value from 0 to 1.

If all the components except alpha are at zero and the alpha is at 1, the result is black. If all are at 1, the result is the brightest representable white.

Important: the component values out of the 0..1 range are not allowed and should not be used.

Types

Link copied to clipboard
public final class Builder
A builder of Color.

Functions

Link copied to clipboard
public float alpha()
Returns the opacity channel value in the 0..1 range.
Link copied to clipboard
public float blue()
Returns the blue channel value in the 0..1 range.
Link copied to clipboard
public float green()
Returns the green channel value in the 0..1 range.
Link copied to clipboard
public boolean isValid()
Returns true if this color is a valid color.
Link copied to clipboard
public static Color.Builder newBuilder()
Creates a new Color builder with the given required parameters.
Link copied to clipboard
public float red()
Returns the red channel value in the 0..1 range.
Link copied to clipboard
public static Color rgb(float red, float green, float blue)
Creates a new Color instance from the passed RGB values with opacity (alpha) channel set to 1 (non-transparent).
Link copied to clipboard
public static Color rgba(float red, float green, float blue, float alpha)
Creates a new Color instance from the passed RGBA values.
Link copied to clipboard
public String toHexRGB()
Returns a string representation for this color in the #RGB hex format.
Link copied to clipboard
public String toHexRGBA()
Returns a string representation for this color in the #RGBA hex format.